package com.guigu.qingcheng.orderservice.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.guigu.qingcheng.pojo.order.TbOrder;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author testjava
 * @since 2020-07-08
 */
public interface TbOrderMapper extends BaseMapper<TbOrder> {

    @Select("SELECT o.`pay_money`,r.* FROM tb_order o, tb_return_order r WHERE o.`id` = r.`order_id` AND r.`order_id` = #{id} ")
    public Map selectOrderById (@Param("id") String id);

    @Select("" +
            "SELECT * FROM qingcheng_goods.`tb_sku` k,qingcheng_goods.`tb_spu` p " +
            "WHERE k.spu_id = p.id AND p.id =  #{id}\n")
    public List<Map> SpuAndSpk (@RequestParam("id")String id);
}
